package com.guaju.yueshangLife.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.guaju.yueshangLife.R;
import com.zhy.autolayout.AutoFrameLayout;


public class ItemGoodsContentDetail extends AutoFrameLayout {

    private TextView tv_key;
    private TextView tv_value;

    public ItemGoodsContentDetail(Context context) {
        super(context);
        init();
    }

    public ItemGoodsContentDetail(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.goods_detail_item);
        String key = a.getString(R.styleable.goods_detail_item_key);
        tv_key.setText(key);
    }

    public ItemGoodsContentDetail(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.goods_detail_item);
        String key = a.getString(R.styleable.goods_detail_item_key);
        tv_key.setText(key);
    }

    private void init() {
        LayoutInflater inflater=LayoutInflater.from(getContext());
        View inflate = inflater.inflate(R.layout.item_content_detail, this);
        tv_key = (TextView)inflate.findViewById(R.id.tv_key);
        tv_value = (TextView)inflate.findViewById(R.id.tv_value);
    }


    public void setKey(String key) {
        tv_key.setText(key);
    }

    public void setValue(String value) {
        tv_value.setText(value);
    }
}
